package main

import (
	"bytes"
	"compress/zlib"
	"encoding/binary"
	"fmt"
	"io"
	"math/rand"
	"net"
	"os"
	"runtime"
	"strconv"
	"sync"
	"time"

	"github.com/andybalholm/brotli"

	"my_code/biligoo/other"
	"my_code/server/monitor/ejson"

	"github.com/valyala/fastjson"
)

var logMutex sync.Mutex

func printLogFile(log string) {
	// 加锁，保证并发安全
	logMutex.Lock()
	defer logMutex.Unlock()

	// 打开或创建日志文件，以追加写入的方式
	file, err := os.OpenFile("monitor-log.txt", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
	if err != nil {
		fmt.Println("Error opening log file:", err)
		return
	}
	defer file.Close()

	// 向日志文件写入一行文本
	_, err = file.WriteString(log + "\n")
	if err != nil {
		fmt.Println("Error writing to log file:", err)
	}
}

type biDanmu struct {
	conn   net.Conn
	roomid int
	live   bool
	online int
}

var (
	UID    int    = 0
	ACCESS string = ""
)

const (
	SERVERWS string = /*"ws://127.0.0.1:56666/ws?key=375ecc98e7d7629f5b816f66160184a0" //*/ "ws://139.155.130.56:56666/ws?key=375ecc98e7d7629f5b816f66160184a1"
)

var bDmap map[int]*biDanmu = map[int]*biDanmu{}
var bDlock *sync.RWMutex

func (d *biDanmu) kill() {
	if d.roomid != 0 {
		d.live = false
		d.conn.Close()
		fmt.Printf("%v房间%v 关闭              ", other.TI(), d.roomid)
	} else {
		fmt.Printf("%v房间%v 关闭(未开)         ", other.TI(), d.roomid)
	}
}
func (d *biDanmu) restart() {
	d.live = false
	d.conn.Close()
	time.Sleep(time.Second * 2)
	danmu(d.roomid)
}
func main() {
	fmt.Println("2024/09/05 10:54")
	if !true {
		room := 7117440
		bDlock.Lock()
		bDmap[room] = &biDanmu{}
		bDlock.Unlock()
		danmu(room)
		select {}
	}
	//monitorRefresh_Old()
	monitorRefresh()
	for {
		line := 0
		fmt.Scanln(&line)
		if line > 1000 {
			bDlock.Lock()
			ok := false
			for k := range bDmap {
				if line == k {
					ok = true
				}
			}
			if ok {
				fmt.Printf("  %v存在\n", line)
			} else {
				fmt.Printf("  %v不存在\n", line)
				go danmu(line)
			}
			bDlock.Unlock()
		} else if line == 0 {
			rs := []int{}
			bDlock.RLock()
			for k, v := range bDmap {
				if v.roomid != 0 {
					rs = append(rs, k)
				}
			}
			bDlock.RUnlock()
			min, max := 999999999, 0
			for _, v := range rs {
				if v < min {
					min = v
				}
				if v > max {
					max = v
				}
			}
			fmt.Printf("协程数:%v  房间数:%v  M:%v %v\n", runtime.NumGoroutine(), len(rs), min, max)
		}
	}
}

func generateRandomString(length int, includeStr string) string {
	availableChars := includeStr
	rand.Seed(time.Now().UnixNano())
	result := make([]byte, length)
	for i := 0; i < length; i++ {
		result[i] = availableChars[rand.Intn(len(availableChars))]
	}
	return string(result)
}

var newDanmu *sync.RWMutex = &sync.RWMutex{}

func danmu(roomid int) (connectOK bool) {
	newDanmu.Lock()
	t1 := other.IntTime()

	defer newDanmu.Unlock()
	//defer fmt.Printf("%v房间%v完成\n", other.TI(), roomid)
	have := false
	var bbb *biDanmu
	bDlock.RLock()
	bbb, have = bDmap[roomid]
	bDlock.RUnlock()
	if !have {
		//fmt.Printf("房间%v不存在而不启动\n", roomid)
		return
	}
	if bbb.live {
		//fmt.Printf("房间%v已监控而不启动\n", roomid)
		return
	}
	time.Sleep(time.Second * 2)
	token, host, port := getDanmuInfo(roomid)
	//fmt.Println(roomid, ":", token, host, port, ACCESS, UID)
	if port == 0 {
		fmt.Println(roomid, ":", token, host, port, UID)
		time.Sleep(time.Second * 60)
		monitorPostErr()
		danmu(roomid)
		return
	}
	//conn, err := net.Dial("tcp", host+":"+strconv.Itoa(port))
	var conn net.Conn
	var err error
	for {
		conn, err = net.DialTimeout("tcp", net.JoinHostPort(host, strconv.Itoa(port)), time.Second)
		if err == nil {
			//fmt.Println("Connected successfully")
			break // 连接成功，退出循环
		} else {
			fmt.Printf("Failed to connect:(%v)%v", roomid, err)
			time.Sleep(time.Second / 2) // 重试
		}
	}
	if err != nil {
		fmt.Println(other.TI()+"拨号出错：", err)
		monitorPostErr()
		//if strings.Contains(err.Error(), "connect: connection timed out") {
		time.Sleep(time.Second * 3)
		danmu(roomid)
		//}
		return
	}
	bdanmu := &biDanmu{conn, roomid, true, -1}
	bDlock.Lock()
	bDmap[roomid] = bdanmu
	bDlock.Unlock()
	//defer conn.Close()
	go read(bdanmu)
	//msg := string([]byte{0, 16, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0}) + `{"clientver":"6.56.0.6560300","group":"","hwid":"RwxOfEx8TA","key":"` + token + `","platform":"android","protover":3,"roomid":` + strconv.Itoa(roomid) + `,"uid":` + strconv.Itoa(UID) + `}`
	msg := string([]byte{0, 16, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0}) + `{"app_id":1,"brand":"BiliBili","build":7440300,"buvid":"XU` + generateRandomString(35, "0123456789ABCDEF") + `","channel":"huawei","clientver":"7.44.0.7440300","group":"","hwid":"` + generateRandomString(31, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + `","key":"` + token + `","mobi_app":"android","model":"SBBili","osver":"13","platform":"android","protover":3,"roomid":` + strconv.Itoa(roomid) + `,"uid":` + strconv.Itoa(UID) + `,"version_name":"7.44.0"}`
	data, err := Encode(msg)
	if err != nil {
		fmt.Println(other.TI()+"encode msg failed, err:", err)
		return
	}
	_, err = conn.Write(data)
	if err != nil {
		fmt.Println("握手err", err)
		monitorPostErr()
		bdanmu.restart()
		return
	}
	go func() {
		for {
			time.Sleep(time.Second * 30)
			msg := string([]byte{0, 16, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0}) + `{}`
			data, err := Encode(msg)
			if err != nil {
				fmt.Println(other.TI()+"encode msg failed, err:", err)
				return
			}
			if !bdanmu.live {
				break
			}
			_, err = conn.Write(data)
			if err != nil {
				fmt.Println("心跳err", err)
				monitorPostErr()
				bdanmu.restart()
				return
			}
		}
	}()

	t2 := other.IntTime()
	if false {
		fmt.Printf("%v房间%v用时%v  \n", other.TI(), roomid, t2-t1)
	}
	return true
}

func read(bdanmu *biDanmu) {
	oldbyte := []byte{}
	for bdanmu.live {
		buff := [2560]byte{}
		n, err := bdanmu.conn.Read(buff[:])
		if !bdanmu.live {
			break
		}
		if err != nil {
			fmt.Println(other.TI()+"recv failed, err:", err)
			bdanmu.restart()
			return
		}
		//fmt.Println(string(buff[:n]))
		buf := append(oldbyte, buff[:n]...)
		oldbyte = danmuBufRead(buf, bdanmu)
		continue
	}
}

// DoZlibUnCompress 进行zlib解压缩
func DoZlibUnCompress(compressSrc []byte) ([]byte, error) {
	b := bytes.NewReader(compressSrc)
	var out bytes.Buffer
	r, err := zlib.NewReader(b)
	if err != nil {
		return compressSrc, err
	}
	io.Copy(&out, r)
	return out.Bytes(), nil
}

// DoBrotliCompress 进行brotli解压缩
func DoBrotliCompress(compressSrc []byte) ([]byte, error) {
	b := bytes.NewReader(compressSrc)
	var out bytes.Buffer
	r := brotli.NewReader(b)

	io.Copy(&out, r)
	return out.Bytes(), nil
}
func gzipmsg(msg []byte, version int, bdanmu *biDanmu) []byte {
	//fmt.Println(msg[:10], string(msg[:10]), "[", 'x', '\x9c', '\x1f', 'B', "]")
	var buf []byte
	var err error
	if version == 3 {
		buf, err = DoBrotliCompress(msg)
	} else if version == 2 {
		buf, err = DoZlibUnCompress(msg)
	} else if version == 0 {
		buf = msg
	}
	if err != nil {
		danmumsg(buf, bdanmu)
		return []byte{}
	}
	if string(msg) == string(buf) {
		fmt.Println("未压缩")
	} else {
		//fmt.Println("已压缩")
	}
	if len(buf) == 0 {
		danmumsg(buf, bdanmu)
		return []byte{}
	}
	//fmt.Println("====<<====", buf, "====>>====")
	//fmt.Println("====<<====", string(buf), "====>>====")
	oldbyte := []byte{}
	for {
		if len(buf) < 4 {
			oldbyte = buf
			break
		}
		//danmumsg(buf, bdanmu)
		alllength := int(buf[3]) + int(buf[2])*256 + int(buf[1])*256*256 + int(buf[0])*256*256*256
		length2 := int(buf[5]) + int(buf[4])*256 // 16
		//	fmt.Println("长度:", alllength)
		if len(buf) < alllength {
			fmt.Println("半包:", string(buf))
			oldbyte = buf
			break
		} else {
			//fmt.Println("------", buf[11])
			//fmt.Println("全包:", string(buf[16:alllength]))
			switch buf[11] {
			case 3:
				fmt.Println(other.TI() + "心跳成功w")
			case 5:
				go danmumsg(buf[length2:alllength], bdanmu)
			case 8:
				fmt.Println(other.TI() + "弹幕连接成功w")
			default:
				fmt.Println(other.TI()+"----其他----w", buf[11])
			}
			if len(buf) == alllength {
				oldbyte = []byte{}
				break
			} else {
				buf = buf[alllength:]
			}
		}
	}
	if len(oldbyte) != 0 {
		fmt.Println("====>", string(oldbyte))
	}
	return oldbyte
}

var cmdmap map[string]string
var cmdlock *sync.RWMutex

func init() {
	cmdmap = map[string]string{}
	cmdlock = &sync.RWMutex{}
	bDlock = &sync.RWMutex{}
}

func danmumsg(msg []byte, bdanmu *biDanmu) {
	if len(msg) <= 4 {
		return
	}
	//fmt.Println("MSG:", string(msg))
	/*if false {
		js, err := simplejson.NewJson(msg)
		if err != nil {
			fmt.Println("cmd json err:", err, string(msg))
			return
		}
		cmd, err := js.Get("cmd").String()
		if err != nil {
			fmt.Println("json cmd err:", err, string(msg))
			return
		}
		for _, v := range TomlInfo.CMD {
			if cmd == v.Value {
				id := js
				for _, vv := range v.IDpath {
					id = id.Get(vv)
				}
				idd := id.Interface()
				ids := ""
				switch idd.(type) {
				case float64:
					ids = strconv.FormatFloat(idd.(float64), 'f', -1, 64)
				case string:
					ids = idd.(string)
				}

				fmt.Printf("%v房间%v 发现%v-%v   %v\n", other.TI(), bdanmu.roomid, v.Name, ids, idd)
			}
		}
		return
	}*/
	ss := ejson.DanmuCmd{}
	err := ss.UnmarshalJSON([]byte(msg))
	if err != nil {
		fmt.Println("UnmarshalJSON err:", err, string(msg))
		//fmt.Println(msg)
		return
	}
	cmd := ss.Cmd
	//cmd := fastjson.GetString(msg, "cmd")
	//fmt.Println("CMD:", cmd)

	switch cmd {
	case "ANCHOR_LOT_START": //{"cmd":"ANCHOR_LOT_START","data":{"asset_icon":"https://i0.hdslb.com/bfs/live/627ee2d9e71c682810e7dc4400d5ae2713442c02.png","award_image":"","award_name":"免费点播一次","award_num":1,"cur_gift_num":0,"current_time":1642343281,"danmu":"","gift_id":3,"gift_name":"B坷垃","gift_num":1,"gift_price":9900,"goaway_time":180,"goods_id":15,"id":2155900,"is_broadcast":1,"join_type":1,"lot_status":0,"max_time":600,"require_text":"无","require_type":0,"require_value":0,"room_id":21685149,"send_gift_ensure":0,"show_panel":1,"start_dont_popup":0,"status":1,"time":599,"url":"https://live.bilibili.com/p/html/live-lottery/anchor-join.html?is_live_half_webview=1\u0026hybrid_biz=live-lottery-anchor\u0026hybrid_half_ui=1,5,100p,100p,000000,0,30,0,0,1;2,5,100p,100p,000000,0,30,0,0,1;3,5,100p,100p,000000,0,30,0,0,1;4,5,100p,100p,000000,0,30,0,0,1;5,5,100p,100p,000000,0,30,0,0,1;6,5,100p,100p,000000,0,30,0,0,1;7,5,100p,100p,000000,0,30,0,0,1;8,5,100p,100p,000000,0,30,0,0,1","web_url":"https://live.bilibili.com/p/html/live-lottery/anchor-join.html"}}
		//fmt.Println(string(msg))
		if TomlInfo.POST.Anchor {
			id := ""
			switch ss.Data.ID.(type) {
			case float64:
				id = strconv.FormatFloat(ss.Data.ID.(float64), 'f', -1, 64)
			case string:
				id = ss.Data.ID.(string)
			}
			price := ss.Data.GiftPrice * ss.Data.GiftNum
			start := ss.Data.CurrentTime + ss.Data.Time - ss.Data.MaxTime
			fmt.Printf("%v天选时刻-%v  房间: %v (%v: %v-%v-%v)        \n", other.TI(), id, bdanmu.roomid, ss.Data.AwardName, ss.Data.RequireType, ss.Data.RequireValue, price)
			if ss.Data.GiftPrice > 0 {
				//fmt.Println(string(msg))
			}
			//fmt.Println(string(msg))
			iid, _ := strconv.Atoi(id)
			rI := getRoomidInfo(bdanmu.roomid)
			uid, uname, face, official_type, official_desc := rI.UID, rI.Uname, rI.Face, rI.OfficialType, rI.OfficialDesc
			awardNum, awardType := ss.Data.AwardNum, ss.Data.AwardType
			giftRoomAdd(bdanmu.roomid, start+ss.Data.MaxTime)
			go postAnchor(bdanmu.roomid, iid, ss.Data.AwardName, ss.Data.RequireType, ss.Data.RequireValue, price, start, ss.Data.MaxTime, bdanmu.online, uid, uname, face, official_type, official_desc, awardNum, awardType)
		}
	case "SPECIAL_GIFT": //{"cmd":"SPECIAL_GIFT","data":{"39":{"action":"start","content":"我选择狗带","hadJoin":0,"id":"3249920767197","num":1,"storm_gif":"http://static.hdslb.com/live-static/live-room/images/gift-section/mobilegift/2/jiezou.gif?2017011901","time":90}}}
		if TomlInfo.POST.Storm {
			//fmt.Println(string(msg))
			if ss.Data.San.Action == "start" {
				id := ""
				switch ss.Data.San.ID.(type) {
				case float64:
					id = strconv.FormatFloat(ss.Data.San.ID.(float64), 'f', -1, 64)
				case string:
					id = ss.Data.San.ID.(string)
				}
				iid, _ := strconv.ParseInt(id, 10, 64)
				fmt.Printf("%v节奏风暴-%v  房间: %v        \n", other.TI(), id, bdanmu.roomid)
				rI := getRoomidInfo(bdanmu.roomid)
				uid, uname, face, official_type, official_desc := rI.UID, rI.Uname, rI.Face, rI.OfficialType, rI.OfficialDesc

				giftRoomAdd(bdanmu.roomid, int(nowTime())+ss.Data.San.Time)
				go postStorm(bdanmu.roomid, iid, 0, ss.Data.San.Time, bdanmu.online, uid, uname, face, official_type, official_desc)
			}
		}
	case "POPULARITY_RED_POCKET_START": //{"cmd":"POPULARITY_RED_POCKET_START","data":{"lot_id":7032,"sender_uid":14913284,"sender_name":"布王","sender_face":"http://i2.hdslb.com/bfs/face/7026dbaf6f77ec0c0cbd4017f8257562217a4733.jpg","join_requirement":1,"danmu":"老板大气！点点红包抽礼物！","current_time":1642342164,"start_time":1642342163,"end_time":1642342343,"last_time":180,"remove_time":1642342358,"replace_time":1642342353,"lot_status":1,"h5_url":"https://live.bilibili.com/p/html/live-app-red-envelope/popularity.html?is_live_half_webview=1\u0026hybrid_half_ui=1,5,100p,100p,000000,0,50,0,0,1;2,5,100p,100p,000000,0,50,0,0,1;3,5,100p,100p,000000,0,50,0,0,1;4,5,100p,100p,000000,0,50,0,0,1;5,5,100p,100p,000000,0,50,0,0,1;6,5,100p,100p,000000,0,50,0,0,1;7,5,100p,100p,000000,0,50,0,0,1;8,5,100p,100p,000000,0,50,0,0,1\u0026hybrid_rotate_d=1\u0026hybrid_biz=popularityRedPacket\u0026lotteryId=7032","user_status":2,"awards":[{"gift_id":31213,"gift_name":"这个好诶","gift_pic":"https://s1.hdslb.com/bfs/live/475494f221873f9654d04ad44c5853740bd89149.png","num":3},{"gift_id":31212,"gift_name":"打call","gift_pic":"https://s1.hdslb.com/bfs/live/f75291a0e267425c41e1ce31b5ffd6bfedc6f0b6.png","num":8},{"gift_id":31214,"gift_name":"牛哇牛哇","gift_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","num":10}],"lot_config_id":4,"total_price":8000}}
		if TomlInfo.POST.PopRed {
			price := ss.Data.TotalPrice
			start := ss.Data.StartTime
			end := ss.Data.EndTime
			fmt.Printf("%v人气红包-%v  房间: %v (￥%v.%v)        \n", other.TI(), ss.Data.LotID, bdanmu.roomid, price/1000, (price-price/1000*1000)/100)
			//fmt.Println(getRoomidInfo(bdanmu.roomid))
			rI := getRoomidInfo(bdanmu.roomid)
			uid, uname, face, official_type, official_desc := rI.UID, rI.Uname, rI.Face, rI.OfficialType, rI.OfficialDesc
			giftRoomAdd(bdanmu.roomid, end)
			go postPopRed(bdanmu.roomid, ss.Data.LotID, price, start, end-start, bdanmu.online, uid, uname, face, official_type, official_desc, 0)
		}
	case "RED_POCKET_START": //{"cmd":"RED_POCKET_START","data":{"background_color":"#C92B4F","content":"\u003c%明日方舟%\u003e送出\u003c%10000万%\u003e金瓜子，30秒后开奖","duration":20,"follow_uids":"161775300,755824","head_icon":"https://i0.hdslb.com/bfs/activity-plat/static/20210116/1d0c5a1b042efb59f46d4ba1286c6727/QPDhSONpxC.png","high_light_text_color":"#FFE6B1","id":160,"new_content":"\u003c%明日方舟%\u003e送出\u003c%1,000,000%\u003e电 池，30秒后开奖","normal_text_color":"#ffffff","num":50000,"remain_time":30,"require_message":"参与自动关注：\u003c%明日方舟%\u003e,\u003c%杨颜同学%\u003e","sender_face":"http://i0.hdslb.com/bfs/face/89154378c06a5ed332c40c2ca56f50cd641c0c90.jpg","sender_name":"明日方舟","sender_uid":755824,"tail_icon":"http://i0.hdslb.com/bfs/live/822da481fdaba986d738db5d8fd469ffa95a8fa1.webp","web_tail_icon":"http://i0.hdslb.com/bfs/live/38cb2a9f1209b16c0f15162b0b553e3b28d9f16f.png"}}
		if TomlInfo.POST.Red {
			id := ""
			switch ss.Data.ID.(type) {
			case float64:
				id = strconv.FormatFloat(ss.Data.ID.(float64), 'f', -1, 64)
			case string:
				id = ss.Data.ID.(string)
			}
			iid, _ := strconv.ParseInt(id, 10, 64)
			fmt.Printf("%v电池红包-%v  房间: %v        \n", other.TI(), id, bdanmu.roomid)
			rI := getRoomidInfo(bdanmu.roomid)
			uid, uname, face, official_type, official_desc := rI.UID, rI.Uname, rI.Face, rI.OfficialType, rI.OfficialDesc

			giftRoomAdd(bdanmu.roomid, int(nowTime())+ss.Data.RemainTime)
			go postRed(bdanmu.roomid, iid, 0, ss.Data.RemainTime, bdanmu.online, uid, uname, face, official_type, official_desc)
		}
	case "COMBO_SEND": //{"cmd":"COMBO_SEND","data":{"action":"投喂","batch_combo_id":"batch:gift:combo_id:6103259:401480763:30607:1642342109.9153","batch_combo_num":12,"combo_id":"gift:combo_id:6103259:401480763:30607:1642342109.9143","combo_num":12,"combo_total_coin":0,"dmscore":80,"gift_id":30607,"gift_name":"小心心","gift_num":0,"is_show":1,"medal_info":{"anchor_roomid":0,"anchor_uname":"","guard_level":0,"icon_id":0,"is_lighted":0,"medal_color":0,"medal_color_border":0,"medal_color_end":0,"medal_color_start":0,"medal_level":0,"medal_name":"","special":"","target_id":0},"name_color":"","r_uname":"眞白花音_Official","ruid":401480763,"send_master":null,"total_num":12,"uid":6103259,"uname":"庭树生花"}}

	case "INTERACT_WORD": //{"cmd":"INTERACT_WORD","data":{"contribution":{"grade":0},"dmscore":20,"fans_medal":{"anchor_roomid":23594422,"guard_level":0,"icon_id":0,"is_lighted":1,"medal_color":6126494,"medal_color_border":6126494,"medal_color_end":6126494,"medal_color_start":6126494,"medal_level":7,"medal_name":"Clowns","score":4900,"special":"","target_id":1042854135},"identities":[3,1],"is_spread":0,"msg_type":1,"roomid":21402309,"score":1642357018105,"spread_desc":"","spread_info":"","tail_icon":0,"timestamp":1642342118,"trigger_time":1642342116997802200,"uid":10768301,"uname":"KennyALin","uname_color":""}}

	case "POPULARITY_RED_POCKET_WINNER_LIST": //{"cmd":"POPULARITY_RED_POCKET_WINNER_LIST","data":{"lot_id":7015,"total_num":39,"winner_info":[{"uid":382955725,"name":"i陌清茗","user_type":0,"award_type":1,"award_id":31215,"award_name":"花式夸夸","award_pic":"https://s1.hdslb.com/bfs/live/d8f43b41722a5874aec1809fa46ec7ac41d7c2b7.png","award_big_pic":"https://i0.hdslb.com/bfs/live/a6d07ef70487c4c6f7b328b2a5d8838e0841482a.png","award_price":33000,"bag_id":106092,"gift_id":31215,"gift_num":1},{"uid":6351284,"name":"墙纸qz","user_type":0,"award_type":1,"award_id":31212,"award_name":"打call","award_pic":"https://s1.hdslb.com/bfs/live/f75291a0e267425c41e1ce31b5ffd6bfedc6f0b6.png","award_big_pic":"https://i0.hdslb.com/bfs/live/9e6521c57f24c7149c054d265818d4b82059f2ef.png","award_price":500,"bag_id":104724,"gift_id":31212,"gift_num":1},{"uid":8892010,"name":"蕾姆单推","user_type":0,"award_type":1,"award_id":31212,"award_name":"打call","award_pic":"https://s1.hdslb.com/bfs/live/f75291a0e267425c41e1ce31b5ffd6bfedc6f0b6.png","award_big_pic":"https://i0.hdslb.com/bfs/live/9e6521c57f24c7149c054d265818d4b82059f2ef.png","award_price":500,"bag_id":106347,"gift_id":31212,"gift_num":1},{"uid":1740101327,"name":"臭--臭今天吃什么","user_type":0,"award_type":1,"award_id":31212,"award_name":"打call","award_pic":"https://s1.hdslb.com/bfs/live/f75291a0e267425c41e1ce31b5ffd6bfedc6f0b6.png","award_big_pic":"https://i0.hdslb.com/bfs/live/9e6521c57f24c7149c054d265818d4b82059f2ef.png","award_price":500,"bag_id":106005,"gift_id":31212,"gift_num":1},{"uid":2694032,"name":"高级伪宅","user_type":0,"award_type":1,"award_id":31212,"award_name":"打call","award_pic":"https://s1.hdslb.com/bfs/live/f75291a0e267425c41e1ce31b5ffd6bfedc6f0b6.png","award_big_pic":"https://i0.hdslb.com/bfs/live/9e6521c57f24c7149c054d265818d4b82059f2ef.png","award_price":500,"bag_id":106851,"gift_id":31212,"gift_num":1},{"uid":1268513632,"name":"魔都大嘟嘟","user_type":0,"award_type":1,"award_id":31212,"award_name":"打call","award_pic":"https://s1.hdslb.com/bfs/live/f75291a0e267425c41e1ce31b5ffd6bfedc6f0b6.png","award_big_pic":"https://i0.hdslb.com/bfs/live/9e6521c57f24c7149c054d265818d4b82059f2ef.png","award_price":500,"bag_id":105796,"gift_id":31212,"gift_num":1},{"uid":370900,"name":"桜抒曲","user_type":0,"award_type":1,"award_id":31212,"award_name":"打call","award_pic":"https://s1.hdslb.com/bfs/live/f75291a0e267425c41e1ce31b5ffd6bfedc6f0b6.png","award_big_pic":"https://i0.hdslb.com/bfs/live/9e6521c57f24c7149c054d265818d4b82059f2ef.png","award_price":500,"bag_id":106349,"gift_id":31212,"gift_num":1},{"uid":1613218230,"name":"A吉祥草王","user_type":0,"award_type":1,"award_id":31212,"award_name":"打call","award_pic":"https://s1.hdslb.com/bfs/live/f75291a0e267425c41e1ce31b5ffd6bfedc6f0b6.png","award_big_pic":"https://i0.hdslb.com/bfs/live/9e6521c57f24c7149c054d265818d4b82059f2ef.png","award_price":500,"bag_id":106348,"gift_id":31212,"gift_num":1},{"uid":62445892,"name":"夏の夜は","user_type":0,"award_type":1,"award_id":31212,"award_name":"打call","award_pic":"https://s1.hdslb.com/bfs/live/f75291a0e267425c41e1ce31b5ffd6bfedc6f0b6.png","award_big_pic":"https://i0.hdslb.com/bfs/live/9e6521c57f24c7149c054d265818d4b82059f2ef.png","award_price":500,"bag_id":106850,"gift_id":31212,"gift_num":1},{"uid":284246234,"name":"铃宝の篠旭","user_type":0,"award_type":1,"award_id":31212,"award_name":"打call","award_pic":"https://s1.hdslb.com/bfs/live/f75291a0e267425c41e1ce31b5ffd6bfedc6f0b6.png","award_big_pic":"https://i0.hdslb.com/bfs/live/9e6521c57f24c7149c054d265818d4b82059f2ef.png","award_price":500,"bag_id":104725,"gift_id":31212,"gift_num":1},{"uid":419194579,"name":"a小超人爆捶大怪兽","user_type":0,"award_type":1,"award_id":31212,"award_name":"打call","award_pic":"https://s1.hdslb.com/bfs/live/f75291a0e267425c41e1ce31b5ffd6bfedc6f0b6.png","award_big_pic":"https://i0.hdslb.com/bfs/live/9e6521c57f24c7149c054d265818d4b82059f2ef.png","award_price":500,"bag_id":103968,"gift_id":31212,"gift_num":1},{"uid":9277299,"name":"yayitinyu","user_type":0,"award_type":1,"award_id":31212,"award_name":"打call","award_pic":"https://s1.hdslb.com/bfs/live/f75291a0e267425c41e1ce31b5ffd6bfedc6f0b6.png","award_big_pic":"https://i0.hdslb.com/bfs/live/9e6521c57f24c7149c054d265818d4b82059f2ef.png","award_price":500,"bag_id":104177,"gift_id":31212,"gift_num":1},{"uid":902924,"name":"柴B","user_type":0,"award_type":1,"award_id":31212,"award_name":"打call","award_pic":"https://s1.hdslb.com/bfs/live/f75291a0e267425c41e1ce31b5ffd6bfedc6f0b6.png","award_big_pic":"https://i0.hdslb.com/bfs/live/9e6521c57f24c7149c054d265818d4b82059f2ef.png","award_price":500,"bag_id":104723,"gift_id":31212,"gift_num":1},{"uid":8237315,"name":"小缘的gachi恋势","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106000,"gift_id":31214,"gift_num":1},{"uid":42546664,"name":"禅身贵族","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":104664,"gift_id":31214,"gift_num":1},{"uid":352520859,"name":"堅果加糖","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":104092,"gift_id":31214,"gift_num":1},{"uid":407811109,"name":"反手就是个名字","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":104217,"gift_id":31214,"gift_num":1},{"uid":37253698,"name":"白菜のcrows7","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106177,"gift_id":31214,"gift_num":1},{"uid":2367128,"name":"眞白慎二","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106172,"gift_id":31214,"gift_num":1},{"uid":22682433,"name":"梨花家的月下","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":105304,"gift_id":31214,"gift_num":1},{"uid":395618297,"name":"揽星_","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106006,"gift_id":31214,"gift_num":1},{"uid":2926540,"name":"子鱼_Yu","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106350,"gift_id":31214,"gift_num":1},{"uid":50033568,"name":"剑神凌天","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106176,"gift_id":31214,"gift_num":1},{"uid":11546988,"name":"绯色孤月","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106173,"gift_id":31214,"gift_num":1},{"uid":27206555,"name":"我酸了啊-啊-啊","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106093,"gift_id":31214,"gift_num":1},{"uid":343572165,"name":"kyo8882619","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106094,"gift_id":31214,"gift_num":1},{"uid":95533020,"name":"独守丶命运","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106352,"gift_id":31214,"gift_num":1},{"uid":1993462297,"name":"哥哥你好厉害","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":105000,"gift_id":31214,"gift_num":1},{"uid":201061,"name":"無風の夜","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106249,"gift_id":31214,"gift_num":1},{"uid":7627806,"name":"取个名字太难了吧orz","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106416,"gift_id":31214,"gift_num":1},{"uid":1069916336,"name":"催更玩家","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":107082,"gift_id":31214,"gift_num":1},{"uid":247069213,"name":"JUSTSAYYOULOVEME","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":105402,"gift_id":31214,"gift_num":1},{"uid":24425071,"name":"Wait-I-know-you","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106248,"gift_id":31214,"gift_num":1},{"uid":27472632,"name":"1836181796","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106852,"gift_id":31214,"gift_num":1},{"uid":3517180,"name":"证明人偶","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106351,"gift_id":31214,"gift_num":1},{"uid":2699378,"name":"来点苹果梨","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106174,"gift_id":31214,"gift_num":1},{"uid":908,"name":"Kaito喜欢看白菜","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":105201,"gift_id":31214,"gift_num":1},{"uid":5302788,"name":"箱终幽渔","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106175,"gift_id":31214,"gift_num":1},{"uid":240766731,"name":"海丸星欧耶","user_type":0,"award_type":1,"award_id":31214,"award_name":"牛哇牛哇","award_pic":"https://s1.hdslb.com/bfs/live/23475a7a6170e0d94ba52720e23060dc7604b735.png","award_big_pic":"https://i0.hdslb.com/bfs/live/3b74c117b4f265edcea261bc5608a58d3a7c300a.png","award_price":100,"bag_id":106106,"gift_id":31214,"gift_num":1}]}}

	case "LIKE_INFO_V3_CLICK": //{"cmd":"LIKE_INFO_V3_CLICK","data":{"show_area":0,"msg_type":6,"like_icon":"https://i0.hdslb.com/bfs/live/23678e3d90402bea6a65251b3e728044c21b1f0f.png","uid":32452682,"like_text":"为主播点赞了","uname":"水原千鹤的不知名男友","uname_color":"","identities":[1],"fans_medal":{"target_id":0,"medal_level":0,"medal_name":"","medal_color":0,"medal_color_start":12632256,"medal_color_end":12632256,"medal_color_border":12632256,"is_lighted":0,"guard_level":0,"special":"","icon_id":0,"anchor_roomid":0,"score":0},"contribution_info":{"grade":0},"dmscore":20}} //ROOM: 7734200

	case "LIKE_INFO_V3_UPDATE": //{"cmd":"LIKE_INFO_V3_UPDATE","data":{"click_count":245806}} //ROOM: 7734200

	case "DANMU_AGGREGATION": //{"cmd":"DANMU_AGGREGATION","data":{"activity_identity":"12558580","activity_source":2,"aggregation_cycle":1,"aggregation_icon":"https://i0.hdslb.com/bfs/live/024f7473753c7cc993413e05c69e8b960086e68f.png","aggregation_num":24,"broadcast_msg_type":0,"dmscore":144,"msg":"下一场PK也要继续赢！","show_rows":1,"show_time":2,"timestamp":1688113250}} //ROOM: 22490788
		p := fastjson.Parser{}
		js, err := p.Parse(string(msg))
		if err != nil {
			fmt.Println("Error parsing JSON:", err)
			return
		}
		activity_identity := js.GetStringBytes("data", "activity_identity")
		aggregation_num := js.GetInt("data", "aggregation_num")
		//fmt.Println(string(activity_identity), "x", aggregation_num, string(msg))
		go postAttended(string(activity_identity), aggregation_num)

	case "AREA_RANK_CHANGED": //{"cmd":"AREA_RANK_CHANGED","data":{"conf_id":18,"rank_name":"聊天热榜","uid":17510848,"rank":1,"icon_url_blue":"https://i0.hdslb.com/bfs/live/18e2990a546d33368200f9058f3d9dbc4038eb5c.png","icon_url_pink":"https://i0.hdslb.com/bfs/live/a6c490c36e88c7b191a04883a5ec15aed187a8f7.png","icon_url_grey":"https://i0.hdslb.com/bfs/live/cb7444b1faf1d785df6265bfdc1fcfc993419b76.png","action_type":1,"timestamp":1688113250,"msg_id":"4915ec66-6aec-4a0e-89cf-f9d810c7a0de","jump_url_link":"https://live.bilibili.com/p/html/live-app-hotrank/index.html?clientType=3\u0026ruid=17510848\u0026conf_id=18\u0026is_live_half_webview=1\u0026hybrid_rotate_d=1\u0026is_cling_player=1\u0026hybrid_half_ui=1,3,100p,70p,f4eefa,0,30,100,0,0;2,2,375,100p,f4eefa,0,30,100,0,0;3,3,100p,70p,f4eefa,0,30,100,0,0;4,2,375,100p,f4eefa,0,30,100,0,0;5,3,100p,70p,f4eefa,0,30,100,0,0;6,3,100p,70p,f4eefa,0,30,100,0,0;7,3,100p,70p,f4eefa,0,30,100,0,0;8,3,100p,70p,f4eefa,0,30,100,0,0#/area-rank","jump_url_pc":"https://live.bilibili.com/p/html/live-app-hotrank/index.html?clientType=4\u0026ruid=17510848\u0026conf_id=18\u0026pc_ui=338,465,f4eefa,0#/area-rank","jump_url_pink":"https://live.bilibili.com/p/html/live-app-hotrank/index.html?clientType=1\u0026ruid=17510848\u0026conf_id=18\u0026is_live_half_webview=1\u0026hybrid_rotate_d=1\u0026hybrid_half_ui=1,3,100p,70p,ffffff,0,30,100,12,0;2,2,375,100p,ffffff,0,30,100,0,0;3,3,100p,70p,ffffff,0,30,100,12,0;4,2,375,100p,ffffff,0,30,100,0,0;5,3,100p,70p,ffffff,0,30,100,0,0;6,3,100p,70p,ffffff,0,30,100,0,0;7,3,100p,70p,ffffff,0,30,100,0,0;8,3,100p,70p,ffffff,0,30,100,0,0#/area-rank","jump_url_web":"https://live.bilibili.com/p/html/live-app-hotrank/index.html?clientType=2\u0026ruid=17510848\u0026conf_id=18#/area-rank"}} //ROOM: 9246513

	case "MULTI_VOICE_OPERATIN": //{"cmd":"MULTI_VOICE_OPERATIN","data":{"uid":3493115455343048,"room_id":26802933,"position":0,"total_price":227600,"total_price_text":"2276","ts":1688113251686688644,"version":1688113251686688644}} //ROOM: 26802933

	case "PANEL_INTERACTIVE_NOTIFY_CHANGE": //{"cmd":"PANEL_INTERACTIVE_NOTIFY_CHANGE","data":{"biz_id":4,"end_time":0,"icon":"https://i0.hdslb.com/bfs/live/164a37487431ce065981d76afe6c2fb2083facee.png","last_time":0,"level":1,"text":"预言状态变更"}} //ROOM: 4245963

	case "INTERACTIVE_USER": //{"cmd":"INTERACTIVE_USER","data":{"type":1,"value":{"delay":5,"dm_msg":"主播已开启预言玩法，点击直播间底部互动按钮参与","prophet_status":2,"send_msg":0}}} //ROOM: 4245963

	case "POPULAR_RANK_CHANGED": //{"cmd":"POPULAR_RANK_CHANGED","data":{"uid":14781725,"rank":4,"countdown":2333,"timestamp":1688113268,"cache_key":"rank_change:0789e60bd36b4e1293742d67bf2622f8"}} //ROOM: 3066386

	case "WIDGET_GIFT_STAR_PROCESS": //{"cmd":"WIDGET_GIFT_STAR_PROCESS","data":{"start_date":20230626,"process_list":[{"gift_id":31036,"gift_img":"https://s1.hdslb.com/bfs/live/8b40d0470890e7d573995383af8a8ae074d485d9.png","gift_name":"礼物星球","completed_num":1,"target_num":200},{"gift_id":31037,"gift_img":"https://s1.hdslb.com/bfs/live/461be640f60788c1d159ec8d6c5d5cf1ef3d1830.png","gift_name":"礼物星球","completed_num":38,"target_num":100},{"gift_id":33031,"gift_img":"https://s1.hdslb.com/bfs/live/c22bc30232a73175399ba701797f7dff103af195.png","gift_name":"礼物星球","completed_num":0,"target_num":1}],"finished":false,"ddl_timestamp":1688313600,"version":1688113276517,"reward_gift":32268,"reward_gift_img":"https://s1.hdslb.com/bfs/live/7ca35670d343096c4bd9cd6d5491aa8a5305f82c.png","reward_gift_name":"礼物星球"}} //ROOM: 9246513

	case "GIFT_STAR_PROCESS": //{"cmd":"GIFT_STAR_PROCESS","data":{"status":1,"tip":"干杯已点亮"}} //ROOM: 392523

	case "RECOMMEND_CARD": //{"cmd":"RECOMMEND_CARD","data":{"title_icon":"https://i0.hdslb.com/bfs/live/3053f47729c4974b1cfe4cd98482c28d4e23a1c2.png","recommend_list":[{"shopping_card_detail":{"goods_id":"1659940909747068928","goods_name":"普罗维登春日游园","goods_price":"6.00","goods_max_price":"","sale_status":0,"coupon_name":"","goods_icon":"https://i0.hdslb.com/bfs/garb/6bd3a8da76b2a7533c763da776085fc5612e32bb.png","goods_status":1,"source":5,"h5_url":"https://www.bilibili.com/h5/mall/suit/detail?id=112950001\u0026navhide=1\u0026rebate=3493113265916063\u0026from_id=49631892\u0026s_video=0\u0026f_source=zhibo\u0026is_live_half_webview=1\u0026hybrid_rotate_d=0\u0026hybrid_half_ui=1,3,100p,70p,0,0,30,100,12,0;2,2,375,100p,0,0,30,100,0,0;3,3,100p,70p,0,0,30,100,12,0;4,2,375,100p,0,0,30,100,0,0;5,3,100p,70p,0,0,30,100,12,0;6,3,100p,70p,0,0,30,100,12,0;7,3,100p,70p,0,0,30,100,12,0\u0026web_type=1\u0026source=5\u0026goods_id=1659940909747068928#/virdress","jump_link":"","schema_url":"","is_pre_sale":0,"activity_info":null,"pre_sale_info":null,"early_bird_info":null,"timestamp":1688113321,"coupon_discount_price":"","selling_point":"","hot_buy_num":167,"gift_buy_info":null,"is_exclusive":false,"coupon_id":"","reward_info":null,"goods_tag_list":null,"virtual_extra_info":{"goods_type":1,"web_container_type":1},"price_info":{"normal":{"prefix_price":"","sale_price":"6.00","suffix_price":"起","strock_price":"","sale_start_time":1684666800,"sale_end_time":1747842300,"strock_show":1},"activity":null},"btn_info":{"card_btn_status":1,"card_btn_title":"去抢购","card_btn_style":1,"card_btn_jumpurl":"","card_btn_route_jump_url":"","card_btn_click_url":""},"goods_sort_id":0,"coupon_info":null,"active_info":null,"jump_url":""},"recommend_card_extra":null},{"shopping_card_detail":{"goods_id":"1620045926012620800","goods_name":"月隐空夜","goods_price":"8.00","goods_max_price":"","sale_status":0,"coupon_name":"","goods_icon":"https://i0.hdslb.com/bfs/garb/item/d00cf5a347ce6be808c0ea754f00bf48a93ade71.jpg","goods_status":1,"source":5,"h5_url":"https://www.bilibili.com/h5/mall/suit/detail?id=33801\u0026navhide=1\u0026rebate=3493076777568981\u0026from_id=49631892\u0026s_video=0\u0026f_source=zhibo\u0026is_live_half_webview=1\u0026hybrid_rotate_d=0\u0026hybrid_half_ui=1,3,100p,70p,0,0,30,100,12,0;2,2,375,100p,0,0,30,100,0,0;3,3,100p,70p,0,0,30,100,12,0;4,2,375,100p,0,0,30,100,0,0;5,3,100p,70p,0,0,30,100,12,0;6,3,100p,70p,0,0,30,100,12,0;7,3,100p,70p,0,0,30,100,12,0\u0026web_type=1\u0026source=5\u0026goods_id=1620045926012620800#/virdress","jump_link":"","schema_url":"","is_pre_sale":0,"activity_info":null,"pre_sale_info":null,"early_bird_info":null,"timestamp":1688113321,"coupon_discount_price":"","selling_point":"","hot_buy_num":127,"gift_buy_info":null,"is_exclusive":false,"coupon_id":"","reward_info":null,"goods_tag_list":null,"virtual_extra_info":{"goods_type":1,"web_container_type":1},"price_info":{"normal":{"prefix_price":"","sale_price":"8.00","suffix_price":"起","strock_price":"","sale_start_time":1642158000,"sale_end_time":0,"strock_show":1},"activity":null},"btn_info":{"card_btn_status":1,"card_btn_title":"去抢购","card_btn_style":1,"card_btn_jumpurl":"","card_btn_route_jump_url":"","card_btn_click_url":""},"goods_sort_id":0,"coupon_info":null,"active_info":null,"jump_url":""},"recommend_card_extra":null}],"timestamp":1688113321,"update_list":[]}} //ROOM: 21292831

	case "DM_INTERACTION": //{"cmd":"DM_INTERACTION","data":{"id":206,"status":5,"type":101,"data":"{\"question\":\"梦岚能拿到三连MVP吗？\",\"options\":[{\"idx\":1,\"desc\":\"必须可以！\",\"cnt\":1154,\"percent\":0.8278335724533716},{\"idx\":2,\"desc\":\"下次一定！\",\"cnt\":240,\"percent\":0.17216642754662842}],\"vote_id\":7069912,\"cnt\":1394,\"duration\":180000,\"left_duration\":140000,\"fade_duration\":1000,\"waiting_duration\":-1,\"result\":2,\"result_text\":\"蓝获胜\",\"component\":\"https://live.bilibili.com/p/html/live-app-guessing-game/vote.html?is_live_half_webview=1\\u0026hybrid_half_ui=1,3,100p,324,0,0,30,100,12,0;2,2,375,100p,0,0,30,100,12,0;3,3,100p,324,0,0,30,100,12,0;4,2,375,100p,0,0,30,100,12,0;5,3,100p,70p,0,0,30,100,12,0;6,3,100p,70p,0,0,30,100,12,0;7,3,100p,70p,0,0,30,100,12,0;8,3,100p,70p,0,0,30,100,12,0\",\"natural_die_duration\":30000,\"my_vote\":0}"}} //ROOM: 21144080

	case "MULTI_VOICE_APPLICATION_USER": //{"cmd":"MULTI_VOICE_APPLICATION_USER","data":{"count":1,"uid":3493258105719385,"anchor_uid":3493075812879152,"operate_uid":0,"want_position":3,"event":1,"toast":"申请了连麦","channel":"","roomId":26751600,"role":0}} //ROOM: 26751600
	case "LIVE_OPEN_PLATFORM_GAME": //{"cmd":"LIVE_OPEN_PLATFORM_GAME","data":{"msg_type":"game_end","msg_sub_type":"game_end","game_name":"欢乐俄罗斯方块","game_code":"1659261256750","game_id":"4e7af3d8-363d-443f-bdd9-69de41c3afd1","game_status":"","game_msg":"","game_conf":"","interactive_panel_conf":"","timestamp":1688113469,"block_uids":[]}} //ROOM: 22490788

	case "LIVE_PANEL_CHANGE_CONTENT": //{"cmd":"LIVE_PANEL_CHANGE_CONTENT","data":{"setting_list":[{"biz_id":1001,"icon":"http://i0.hdslb.com/bfs/live/afd5bc2424ebf7c7c9c68d71ba5a1f7d08154519.png","title":"分享","note":"分享","weight":100,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":1,"tab":null,"dynamic_icon":"","sub_icon":"","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":1012,"icon":"http://i0.hdslb.com/bfs/live/1e3cb35056ebbcc1af5f08f4fe7916f095db26a5.png","title":"管理员","note":"管理员","weight":36,"status_type":1,"notification":null,"custom":null,"jump_url":"https://live.bilibili.com/p/html/live-app-room-admin/index.html?is_live_half_webview=1#/roomManagement","type_id":1,"tab":null,"dynamic_icon":"","sub_icon":"","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":1011,"icon":"http://i0.hdslb.com/bfs/live/7dbaf07b4c10182aeb0e7a8eda3273d40bb9b9b5.png","title":"小窗播放","note":"小窗播放","weight":15.001,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":1,"tab":null,"dynamic_icon":"","sub_icon":"","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":1003,"icon":"http://i0.hdslb.com/bfs/live/a5407c843e72d5efb678b649aecd7184f0d68494.png","title":"播放设置","note":"播放设置","weight":9,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":1,"tab":null,"dynamic_icon":"","sub_icon":"","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":1004,"icon":"http://i0.hdslb.com/bfs/live/1a1b3b9819f78df76f66b3657a6be2cc0e9b8853.png","title":"弹幕设置","note":"弹幕设置","weight":8,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":1,"tab":null,"dynamic_icon":"","sub_icon":"","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":1002,"icon":"http://i0.hdslb.com/bfs/live/1b19309441c997d8e9a19ddb939ff6dda2a04a64.png","title":"画质","note":"画质","weight":7,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":1,"tab":null,"dynamic_icon":"","sub_icon":"","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":1005,"icon":"http://i0.hdslb.com/bfs/live/12d66e639a677df2e8b6630a9abe06806acce87d.png","title":"隐藏特效","note":"隐藏特效","weight":6,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":1,"tab":null,"dynamic_icon":"","sub_icon":"","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":1008,"icon":"http://i0.hdslb.com/bfs/live/fe04b9ab783d3a0a4798c20303166b07dcdf8f1d.png","title":"投屏","note":"投屏","weight":5,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":1,"tab":null,"dynamic_icon":"","sub_icon":"","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":1007,"icon":"http://i0.hdslb.com/bfs/live/7e25a262e1cdf294a5d6ca2b1b1527ef4f7caf62.png","title":"举报","note":"举报","weight":5,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":1,"tab":null,"dynamic_icon":"","sub_icon":"","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":1009,"icon":"http://i0.hdslb.com/bfs/live/8e41f28e574952208fe73d09d464c8b369a1a4e9.png","title":"反馈","note":"反馈","weight":4,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":1,"tab":null,"dynamic_icon":"","sub_icon":"","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":1013,"icon":"https://i0.hdslb.com/bfs/live/856061fa98257d996a34850ef4f7a052af6fb3a3.png","title":"清屏","note":"清屏","weight":3,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":1,"tab":null,"dynamic_icon":"","sub_icon":"","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":1006,"icon":"http://i0.hdslb.com/bfs/live/628cdab93480f1f3dfcb4430a1ff08c81c1b6aec.png","title":"仅播声音","note":"仅播声音","weight":2,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":1,"tab":null,"dynamic_icon":"","sub_icon":"","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":1014,"icon":"http://i0.hdslb.com/bfs/live/0884ed6a7c55baf37554c15d79e03c7948421d9b.png","title":"色觉优化","note":"色觉优化","weight":1,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":1,"tab":null,"dynamic_icon":"","sub_icon":"","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":1010,"icon":"http://i0.hdslb.com/bfs/live/1c8331a2c520093a830df0ebf9b5f58eb28cd22d.png","title":"添至桌面","note":"添至桌面","weight":1,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":1,"tab":null,"dynamic_icon":"","sub_icon":"","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null}],"interaction_list":[{"biz_id":999,"icon":"https://i0.hdslb.com/bfs/live/6c068a5ec8e316ca1b3c9a97ba8e47707b3a0fc8.png","title":"魔法奇遇","note":"魔法奇遇","weight":1,"status_type":1,"notification":null,"custom":[{"icon":"https://i0.hdslb.com/bfs/live/6c068a5ec8e316ca1b3c9a97ba8e47707b3a0fc8.png","title":"魔法奇遇","note":"魔法奇遇","jump_url":"https://live.bilibili.com/activity/live-activity-full/full-next/index.html?app_name=magical_adventure\u0026-Abrowser=live\u0026is_live_half_webview=1\u0026source_event=1\u0026hybrid_half_ui=1,3,100p,80p,0,0,30,100,15,0;2,2,375,100p,0,0,30,100,15,0;3,3,100p,80p,0,0,30,100,15,0;4,2,375,100p,0,0,30,100,15,0;5,3,100p,80p,0,0,30,100,15,0;6,3,100p,80p,0,0,30,100,15,0;7,3,100p,80p,0,0,30,100,15,0;8,3,100p,80p,0,0,30,100,15,0\u0026room_id=22490788\u0026uid=25237642#/","status":0,"sub_icon":"https://i0.hdslb.com/bfs/live/a21478ac7eba92d69ddc7655666083d03756a683.png"}],"jump_url":"https://live.bilibili.com/activity/live-activity-full/full-next/index.html?app_name=magical_adventure\u0026-Abrowser=live\u0026is_live_half_webview=1\u0026source_event=1\u0026hybrid_half_ui=1,3,100p,80p,0,0,30,100,15,0;2,2,375,100p,0,0,30,100,15,0;3,3,100p,80p,0,0,30,100,15,0;4,2,375,100p,0,0,30,100,15,0;5,3,100p,80p,0,0,30,100,15,0;6,3,100p,80p,0,0,30,100,15,0;7,3,100p,80p,0,0,30,100,15,0;8,3,100p,80p,0,0,30,100,15,0\u0026room_id=22490788\u0026uid=25237642#/","type_id":2,"tab":{"type":"H5","biz_type":"common-H5","tab_comment":null,"tab_topic":null,"aggregation":0,"id":0,"sub_title":"","sub_icon":"","show_outer_aggregation":0,"show_guide_bubble":"","global_id":""},"dynamic_icon":"","sub_icon":"https://i0.hdslb.com/bfs/live/a21478ac7eba92d69ddc7655666083d03756a683.png","panel_icon":"http://i0.hdslb.com/bfs/live/c339a3569df7351406f29afae77a917aec3073a3.png","match_entrance":0,"icon_info":null},{"biz_id":3,"icon":"https://i0.hdslb.com/bfs/live/a02f9edd13bf77588ec8ed800cf246fbbc158ff3.png","title":"醒目留言","note":"留言传递心意吧","weight":3,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":2,"tab":null,"dynamic_icon":"","sub_icon":"https://i0.hdslb.com/bfs/live/da519a9d33dd9cf8d6bb38c481cea9180341abbe.png","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null}],"outer_list":[{"biz_id":997,"icon":"https://i0.hdslb.com/bfs/live/273904e5c84d293f5f9df5ade5ac0fadc34e9fad.png","title":"送礼","note":"","weight":100,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":2,"tab":null,"dynamic_icon":"https://i0.hdslb.com/bfs/live/a812dfafd427714b3623a352618ca70fa0379c75.webp","sub_icon":"https://i0.hdslb.com/bfs/live/b0b675140c28310a0ff54b05b2fd9a11a5898acf.png","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":33,"icon":"https://i0.hdslb.com/bfs/live/a0e4a9381f9627d2ed89ab67d5ccce1bc1de7ea3.png","title":"购物车","note":"购物车","weight":100,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":2,"tab":null,"dynamic_icon":"","sub_icon":"https://i0.hdslb.com/bfs/live/76b00ae4363ab572be565dbb62fd44d7c6c7d198.png","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":998,"icon":"https://i0.hdslb.com/bfs/live/ec39c5ec3185f58608e4c143f2461726794403b0.png","title":"更多","note":"","weight":99,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":2,"tab":null,"dynamic_icon":"","sub_icon":"","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":30,"icon":"https://s1.hdslb.com/bfs/live/8b40d0470890e7d573995383af8a8ae074d485d9.png","title":"快捷送礼","note":"快捷送礼","weight":97,"status_type":1,"notification":null,"custom":[{"icon":"https://s1.hdslb.com/bfs/live/8b40d0470890e7d573995383af8a8ae074d485d9.png","title":"","note":"{\"bubble_text\":\"点击投喂一个%s，让主播感受到你的支持！\",\"desc_text\":\"投喂一个%s支持主播~\",\"duration\":5,\"gift_id\":31036}","jump_url":"","status":0,"sub_icon":"https://s1.hdslb.com/bfs/live/8b40d0470890e7d573995383af8a8ae074d485d9.png"}],"jump_url":"","type_id":2,"tab":null,"dynamic_icon":"","sub_icon":"https://s1.hdslb.com/bfs/live/8b40d0470890e7d573995383af8a8ae074d485d9.png","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":16,"icon":"https://i0.hdslb.com/bfs/live/024b6050b1cf11ed656a499f013ca14681a131c6.png","title":"表情包","note":"表情包","weight":90,"status_type":1,"notification":null,"custom":null,"jump_url":"","type_id":2,"tab":null,"dynamic_icon":"","sub_icon":"https://i0.hdslb.com/bfs/live/57b7d3953b5663931c59f7e889cef76950591f03.png","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null},{"biz_id":2,"icon":" ","title":"语音连麦","note":" ","weight":5,"status_type":1,"notification":null,"custom":[{"icon":"https://i0.hdslb.com/bfs/live/e3a8c212bc493b88a33fe1853a16270e22d9a70b.png","title":"","note":"连麦功能关闭","jump_url":"","status":2,"sub_icon":"https://i0.hdslb.com/bfs/live/e429e283dbd9e25092a5a73b604527a646cbad32.png"},{"icon":"https://i0.hdslb.com/bfs/live/b8cabd73def53d85bd092f4e8b3f9f6534ec2dc6.png","title":"","note":"连麦","jump_url":"","status":1,"sub_icon":"https://i0.hdslb.com/bfs/live/9500b71c99451040e96312a0f60f269f5c6f0100.png"},{"icon":"https://i0.hdslb.com/bfs/live/c25451d846c5c36a56874626c6496743e6c8b726.webp","title":"","note":"等待中","jump_url":"","status":3,"sub_icon":"https://i0.hdslb.com/bfs/live/0a4e8a81ccc673d7985b6a3c9ecc88baaa0c1e35.webp"},{"icon":"https://i0.hdslb.com/bfs/live/bcf5f48883ddbb96c8680bcc9ed2d4c11798e526.webp","title":"","note":"连麦中","jump_url":"","status":4,"sub_icon":"https://i0.hdslb.com/bfs/live/846230df75319bbe171db0e0d18ec5a8a80e514b.webp"}],"jump_url":"","type_id":2,"tab":null,"dynamic_icon":"","sub_icon":"","panel_icon":"https://i0.hdslb.com/bfs/live/98e692836d408ab7f2b321c717e866a8fd9b3bfd.png","match_entrance":0,"icon_info":null}],"panel_data":null,"is_fixed":0,"is_match":0,"match_cristina":"","match_icon":"","match_bg_image":""}} //ROOM: 22490788

	case "DANMU_MSG": //{"cmd":"DANMU_MSG","info":[[0,1,25,5816798,1642342119617,1642339545,0,"492cbbfb",0,0,0,"",0,"{}","{}",{"mode":0,"show_player_type":0,"extra":"{\"send_from_me\":false,\"mode\":0,\"color\":5816798,\"dm_type\":0,\"font_size\":25,\"player_mode\":1,\"show_player_type\":0,\"content\":\"啊？\",\"user_hash\":\"1227668475\",\"emoticon_unique\":\"\",\"direction\":0,\"pk_direction\":0,\"space_type\":\"\",\"space_url\":\"\"}"}],"啊？",[13455418,"肉包摊子",0,0,0,10000,1,""],[15,"帕清姬","眞白花音_Official",21402309,12478086,"",0,12478086,12478086,12478086,0,1,401480763],[20,0,6406234,"\u003e50000",0],["",""],0,0,null,{"ts":1642342119,"ct":"98FF79DA"},0,0,null,null,0,63]}

		//fmt.Println(string(msg))
		//	user := fastjson.GetString(msg, "info", "2", "1")
		uidd := fastjson.GetInt(msg, "info", "2", "0")
		ty := fastjson.GetInt(msg, "info", "0", "9")
		//	message := fastjson.GetString(msg, "info", "1")
		//p := fmt.Sprintf("%v%v: %v %v %v", other.TI(), user, message, uid, ty)
		//fmt.Println(p)
		if ty == 2 {
			if UID != 0 && UID == uidd {
				fmt.Printf("%v用户 在房间%v 人气红包 真·参与成功 \n", other.TI(), bdanmu.roomid)
			}
		}

	case "ONLINE_RANK_COUNT": //{"cmd":"ONLINE_RANK_COUNT","data":{"count":438}}
		count := fastjson.GetInt(msg, "data", "count")
		if bdanmu.online != count {
			bdanmu.online = count
			if giftRoomHave(bdanmu.roomid) {
				go postOnline(bdanmu.roomid, count)
			}
		}
	case "LIVE_INTERACTIVE_GAME": //{"cmd":"LIVE_INTERACTIVE_GAME","data":{"type":1,"uid":908,"uname":"Kaito喜欢看白菜","uface":"http://i2.hdslb.com/bfs/face/e16a0cdaaa9509a4262582caf12039d1dc3bb96c.jpg","gift_id":31214,"gift_name":"牛哇牛哇","gift_num":1,"price":100,"paid":true,"msg":"","fans_medal_level":30,"guard_level":2,"timestamp":1642342122,"anchor_lottery":null,"pk_info":null,"anchor_info":{"uid":401480763,"uname":"眞白花音_Official","uface":"http://i0.hdslb.com/bfs/face/39af8dc4d3067f2678db85fa02416e24567a5c57.jpg"}}}

	case "SEND_GIFT": //{"cmd":"SEND_GIFT","data":{"action":"投喂","batch_combo_id":"batch:gift:combo_id:908:401480763:31214:1642342122.5827","batch_combo_send":{"action":"投喂","batch_combo_id":"batch:gift:combo_id:908:401480763:31214:1642342122.5827","batch_combo_num":1,"blind_gift":null,"gift_id":31214,"gift_name":"牛哇牛哇","gift_num":1,"send_master":null,"uid":908,"uname":"Kaito喜欢看白菜"},"beatId":"","biz_source":"Live","blind_gift":null,"broadcast_id":0,"coin_type":"gold","combo_resources_id":1,"combo_send":{"action":"投喂","combo_id":"gift:combo_id:908:401480763:31214:1642342122.5811","combo_num":1,"gift_id":31214,"gift_name":"牛哇牛哇","gift_num":1,"send_master":null,"uid":908,"uname":"Kaito喜欢看白菜"},"combo_stay_time":3,"combo_total_coin":100,"crit_prob":0,"demarcation":1,"discount_price":100,"dmscore":128,"draw":0,"effect":0,"effect_block":0,"face":"http://i2.hdslb.com/bfs/face/e16a0cdaaa9509a4262582caf12039d1dc3bb96c.jpg","float_sc_resource_id":0,"giftId":31214,"giftName":"牛哇牛哇","giftType":0,"gold":0,"guard_level":2,"is_first":true,"is_special_batch":0,"magnification":1,"medal_info":{"anchor_roomid":0,"anchor_uname":"","guard_level":2,"icon_id":0,"is_lighted":1,"medal_color":2951253,"medal_color_border":16771156,"medal_color_end":10329087,"medal_color_start":2951253,"medal_level":30,"medal_name":"帕清姬","special":"","target_id":401480763},"name_color":"#E17AFF","num":1,"original_gift_name":"","price":100,"rcost":33983070,"remain":0,"rnd":"1642342122121800001","send_master":null,"silver":0,"super":0,"super_batch_gift_num":1,"super_gift_num":1,"svga_block":0,"tag_image":"","tid":"1642342122121800001","timestamp":1642342122,"top_list":null,"total_coin":100,"uid":908,"uname":"Kaito喜欢看白菜"}}

	case "ENTRY_EFFECT": //{"cmd":"ENTRY_EFFECT","data":{"id":4,"uid":7817590,"target_id":401480763,"mock_effect":0,"face":"https://i1.hdslb.com/bfs/face/e8aa420940a2d7bdeb119ad47638cf95814038e4.jpg","privilege_type":3,"copy_writing":"欢迎舰长 \u003c%右逝花音%\u003e 进入直播间","copy_color":"#ffffff","highlight_color":"#E6FF00","priority":1,"basemap_url":"https://i0.hdslb.com/bfs/live/mlive/f34c7441cdbad86f76edebf74e60b59d2958f6ad.png","show_avatar":1,"effective_time":2,"web_basemap_url":"https://i0.hdslb.com/bfs/live/mlive/f34c7441cdbad86f76edebf74e60b59d2958f6ad.png","web_effective_time":2,"web_effect_close":0,"web_close_time":0,"business":1,"copy_writing_v2":"欢迎舰长 \u003c%右逝花音%\u003e 进入直播间","icon_list":[],"max_delay_time":7,"trigger_time":1642342126780837191,"identities":6}}

	case "SUPER_CHAT_MESSAGE": //{"cmd":"SUPER_CHAT_MESSAGE","data":{"background_bottom_color":"#2A60B2","background_color":"#EDF5FF","background_color_end":"#405D85","background_color_start":"#3171D2","background_icon":"","background_image":"https://i0.hdslb.com/bfs/live/a712efa5c6ebc67bafbe8352d3e74b820a00c13e.png","background_price_color":"#7497CD","color_point":0.7,"dmscore":72,"end_time":1642342595,"gift":{"gift_id":12000,"gift_name":"醒目留言","num":1},"id":3038941,"is_ranked":0,"is_send_audit":0,"medal_info":{"anchor_roomid":1017,"anchor_uname":"逍遥散人","guard_level":0,"icon_id":0,"is_lighted":1,"medal_color":"#be6686","medal_color_border":12478086,"medal_color_end":12478086,"medal_color_start":12478086,"medal_level":15,"medal_name":"刺儿","special":"","target_id":168598},"message":"散人干不死！！！","message_font_color":"#A3F6FF","message_trans":"","price":30,"rate":1000,"start_time":1642342535,"time":60,"token":"8276910F","trans_mark":0,"ts":1642342535,"uid":128794618,"user_info":{"face":"http://i1.hdslb.com/bfs/face/6607bbbda3fb9a1c1491fac4fbdbb5aad0e09517.jpg","face_frame":"","guard_level":0,"is_main_vip":0,"is_svip":0,"is_vip":0,"level_color":"#969696","manager":0,"name_color":"#666666","title":"0","uname":"莫心无良","user_level":1}},"roomid":1017}

	case "SUPER_CHAT_MESSAGE_JPN": //{"cmd":"SUPER_CHAT_MESSAGE_JPN","data":{"id":"3038941","uid":"128794618","price":30,"rate":1000,"message":"\u6563\u4eba\u5e72\u4e0d\u6b7b\uff01\uff01\uff01","message_jpn":"","is_ranked":0,"background_image":"https:\/\/i0.hdslb.com\/bfs\/live\/a712efa5c6ebc67bafbe8352d3e74b820a00c13e.png","background_color":"#EDF5FF","background_icon":"","background_price_color":"#7497CD","background_bottom_color":"#2A60B2","ts":1642342536,"token":"31E2BCCC","medal_info":{"icon_id":0,"target_id":168598,"special":"","anchor_uname":"\u900d\u9065\u6563\u4eba","anchor_roomid":1017,"medal_level":15,"medal_name":"\u523a\u513f","medal_color":"#be6686"},"user_info":{"uname":"\u83ab\u5fc3\u65e0\u826f","face":"http:\/\/i1.hdslb.com\/bfs\/face\/6607bbbda3fb9a1c1491fac4fbdbb5aad0e09517.jpg","face_frame":"","guard_level":0,"user_level":1,"level_color":"#969696","is_vip":0,"is_svip":0,"is_main_vip":0,"title":"0","manager":0},"time":59,"start_time":1642342535,"end_time":1642342595,"gift":{"num":1,"gift_id":12000,"gift_name":"\u9192\u76ee\u7559\u8a00"}},"roomid":"1017"}

	case "ROOM_CHANGE": //{"cmd":"ROOM_CHANGE","data":{"title":"\u6b22\u4e50\u5403\u5403\u5403","area_id":283,"parent_area_id":6,"area_name":"\u72ec\u7acb\u6e38\u620f","parent_area_name":"\u5355\u673a\u6e38\u620f","live_key":"200344423173719033","sub_session_key":"200344423173719033sub_time:1642331612"}}

	case "ONLINE_RANK_V2": //{"cmd":"ONLINE_RANK_V2","data":{"list":[{"uid":2042607,"face":"http://i0.hdslb.com/bfs/face/42377f7b9a12a9e9ebfe5a07ff3fb5adca64949b.jpg","score":"8345","uname":"-雅名-","rank":1,"guard_level":3},{"uid":510955228,"face":"http://i1.hdslb.com/bfs/face/8075f44fc89a9a8f31930e630ae876c8a44fbdf3.jpg","score":"3085","uname":"梦子不是孟子啊喂","rank":2,"guard_level":3},{"uid":11096631,"face":"http://i0.hdslb.com/bfs/face/e8f0c07aae0359a7142f4a2cd66883c297d099d3.jpg","score":"2735","uname":"S懒得起名字","rank":3,"guard_level":3},{"uid":384371334,"face":"http://i0.hdslb.com/bfs/face/182d530cc2207dd532699a2e2597bd70aa3eaae2.jpg","score":"2620","uname":"橘子汽水不冒泡泡","rank":4,"guard_level":3},{"uid":326235800,"face":"http://i2.hdslb.com/bfs/face/9ea8346f05de182a73e878576a782ceffce64b41.jpg","score":"1980","uname":"微苦奶咖","rank":5,"guard_level":3},{"uid":85335593,"face":"http://i2.hdslb.com/bfs/face/c64344051b6671beac930fac501406a29636d5f9.jpg","score":"1980","uname":"青提狂热症","rank":6,"guard_level":3},{"uid":1922581,"face":"http://i1.hdslb.com/bfs/face/717008cfa1f27b12e2c9e73eddc6eeb4d181f6b7.jpg","score":"1799","uname":"是一颗夏威夷果","rank":7,"guard_level":2}],"rank_type":"gold-rank"}}

	case "ONLINE_RANK_TOP3": //{"cmd":"ONLINE_RANK_TOP3","data":{"dmscore":112,"list":[{"msg":"恭喜 \u003c%S懒得起名字%\u003e 成为高能榜","rank":3}]}}

	case "PK_BATTLE_FINAL_PROCESS": //{"cmd":"PK_BATTLE_FINAL_PROCESS","data":{"battle_type":1,"pk_frozen_time":1642343103},"pk_id":300281167,"pk_status":301,"timestamp":1642342924}

	case "COMMON_NOTICE_DANMAKU": //{"cmd":"COMMON_NOTICE_DANMAKU","data":{"content_segments":[{"font_color":"#FB7299","text":"绝杀时刻开启，绝杀结束时领先对手500乱斗值，即可触发绝杀提前赢得大乱斗胜利！","type":1}],"dmscore":144,"terminals":[1,2,3,4,5]}}

	case "ANCHOR_LOT_AWARD": //{"cmd":"ANCHOR_LOT_AWARD","data":{"award_dont_popup":0,"award_image":"","award_name":"免费点播一次","award_num":1,"award_users":[],"id":2155808,"lot_status":2,"url":"https://live.bilibili.com/p/html/live-lottery/anchor-join.html?is_live_half_webview=1\u0026hybrid_biz=live-lottery-anchor\u0026hybrid_half_ui=1,5,100p,100p,000000,0,30,0,0,1;2,5,100p,100p,000000,0,30,0,0,1;3,5,100p,100p,000000,0,30,0,0,1;4,5,100p,100p,000000,0,30,0,0,1;5,5,100p,100p,000000,0,30,0,0,1;6,5,100p,100p,000000,0,30,0,0,1;7,5,100p,100p,000000,0,30,0,0,1;8,5,100p,100p,000000,0,30,0,0,1","web_url":"https://live.bilibili.com/p/html/live-lottery/anchor-join.html"}}

	case "ANCHOR_LOT_END": //{"cmd":"ANCHOR_LOT_END","data":{"id":2155808}}

	case "PK_BATTLE_SETTLE": //{"cmd":"PK_BATTLE_SETTLE","pk_id":300281123,"pk_status":401,"settle_status":1,"timestamp":1642343054,"data":{"battle_type":1,"result_type":-1,"star_light_msg":""},"roomid":"22759731"}

	case "PK_BATTLE_PRE_NEW": //{"cmd":"PK_BATTLE_PRE_NEW","pk_status":101,"pk_id":300281350,"timestamp":1642343073,"data":{"battle_type":1,"match_type":1,"uname":"\u4eba\u95f4\u59b2\u5df1biu","face":"http:\/\/i1.hdslb.com\/bfs\/face\/10b8e31a04c28c3957d587b7c2e66c70affba845.jpg","uid":645787918,"room_id":22887408,"season_id":43,"pre_timer":10,"pk_votes_name":"\u4e71\u6597\u503c","end_win_task":null},"roomid":22759731}

	case "PK_BATTLE_PRE": //{"cmd":"PK_BATTLE_PRE","pk_status":101,"pk_id":300281350,"timestamp":1642343073,"data":{"battle_type":1,"match_type":1,"uname":"\u4eba\u95f4\u59b2\u5df1biu","face":"http:\/\/i1.hdslb.com\/bfs\/face\/10b8e31a04c28c3957d587b7c2e66c70affba845.jpg","uid":645787918,"room_id":22887408,"season_id":43,"pre_timer":10,"pk_votes_name":"\u4e71\u6597\u503c","end_win_task":null},"roomid":22759731}

	case "PK_BATTLE_START_NEW": //{"cmd":"PK_BATTLE_START_NEW","pk_id":300281350,"pk_status":201,"timestamp":1642343083,"data":{"battle_type":1,"final_hit_votes":0,"pk_start_time":1642343083,"pk_frozen_time":1642343383,"pk_end_time":1642343393,"pk_votes_type":0,"pk_votes_add":0,"pk_votes_name":"\u4e71\u6597\u503c","star_light_msg":"","pk_countdown":1642343323,"final_conf":{"switch":1,"start_time":1642343203,"end_time":1642343263},"init_info":{"room_id":22759731,"date_streak":0},"match_info":{"room_id":22887408,"date_streak":5}},"roomid":"22759731"}

	case "PK_BATTLE_START": //{"cmd":"PK_BATTLE_START","pk_id":300281350,"pk_status":201,"timestamp":1642343083,"data":{"battle_type":1,"final_hit_votes":0,"pk_start_time":1642343083,"pk_frozen_time":1642343383,"pk_end_time":1642343393,"pk_votes_type":0,"pk_votes_add":0,"pk_votes_name":"\u4e71\u6597\u503c","star_light_msg":"","pk_countdown":1642343323,"final_conf":{"switch":1,"start_time":1642343203,"end_time":1642343263},"init_info":{"room_id":22759731,"date_streak":0},"match_info":{"room_id":22887408,"date_streak":5}},"roomid":"22759731"}

	case "SUPER_CHAT_ENTRANCE": //{"cmd":"SUPER_CHAT_ENTRANCE","data":{"status":0,"jump_url":"https:\/\/live.bilibili.com\/p\/html\/live-app-superchat2\/index.html?is_live_half_webview=1&hybrid_half_ui=1,3,100p,70p,ffffff,0,30,100;2,2,375,100p,ffffff,0,30,100;3,3,100p,70p,ffffff,0,30,100;4,2,375,100p,ffffff,0,30,100;5,3,100p,60p,ffffff,0,30,100;6,3,100p,60p,ffffff,0,30,100;7,3,100p,60p,ffffff,0,30,100","icon":"https:\/\/i0.hdslb.com\/bfs\/live\/0a9ebd72c76e9cbede9547386dd453475d4af6fe.png","broadcast_type":0},"roomid":"7117440"}

	case "ANCHOR_LOT_CHECKSTATUS": //{"cmd":"ANCHOR_LOT_CHECKSTATUS","data":{"id":2155900,"status":4,"uid":361383367}}

	case "VOICE_JOIN_LIST": //{"cmd":"VOICE_JOIN_LIST","data":{"room_id":23101982,"category":1,"apply_count":1,"red_point":1,"refresh":1},"roomid":23101982}

	case "VOICE_JOIN_ROOM_COUNT_INFO": //{"cmd":"VOICE_JOIN_ROOM_COUNT_INFO","data":{"room_id":23101982,"root_status":1,"room_status":1,"apply_count":1,"notify_count":0,"red_point":0},"roomid":23101982}

	case "LIVE": //{"cmd":"LIVE","live_key":"203493428777753216","voice_background":"","sub_session_key":"203493428777753216sub_time:1642343424","live_platform":"pc","live_model":0,"live_time":1642343424,"roomid":7117440}

	case "PREPARING": //{"cmd":"PREPARING","roomid":"7117440"}

	case "TRADING_SCORE": //{"cmd":"TRADING_SCORE","data":{"bubble_show_time":3,"num":5,"score_id":3,"uid":516773400,"update_time":1642343936,"update_type":1}}

	case "NOTICE_MSG": //{"cmd":"NOTICE_MSG","id":206,"name":"提督跑马灯","full":{"head_icon":"https://i0.hdslb.com/bfs/live/ad14c5f253aa1648245a1fdc7c75e223165627c1.png","tail_icon":"https://i0.hdslb.com/bfs/live/822da481fdaba986d738db5d8fd469ffa95a8fa1.webp","head_icon_fa":"https://i0.hdslb.com/bfs/live/ad14c5f253aa1648245a1fdc7c75e223165627c1.png","tail_icon_fa":"https://i0.hdslb.com/bfs/live/38cb2a9f1209b16c0f15162b0b553e3b28d9f16f.png","head_icon_fan":1,"tail_icon_fan":4,"background":"#FFB03CFF","color":"#FFFFFFFF","highlight":"#B25AC1FF","time":10},"half":{"head_icon":"","tail_icon":"","background":"","color":"","highlight":"","time":0},"side":{"head_icon":"https://i0.hdslb.com/bfs/live/c3045552b787cf1643244f88e533091ea2c26d24.png","background":"#FFE9C8FF","color":"#EF903AFF","highlight":"#D54900FF","border":"#FFCFA4FF"},"roomid":23101982,"real_roomid":23101982,"msg_common":"","msg_self":"\u003c%Shiki心晴%\u003e 续费了主播的 \u003c%提督%\u003e","link_url":"","msg_type":3,"shield_uid":-1,"business_id":"","scatter":{"min":0,"max":0},"marquee_id":"","notice_type":0}

	case "GUARD_BUY": //{"cmd":"GUARD_BUY","data":{"uid":8188680,"username":"Shiki心晴","guard_level":2,"num":1,"price":1998000,"gift_id":10002,"gift_name":"提督","start_time":1642344060,"end_time":1642344060}}

	case "USER_TOAST_MSG": //{"cmd":"USER_TOAST_MSG","data":{"anchor_show":true,"color":"#E17AFF","dmscore":96,"effect_id":398,"end_time":1642344060,"guard_level":2,"is_show":0,"num":1,"op_type":2,"payflow_id":"2201162241008512186805866","price":1598000,"role_name":"提督","start_time":1642344060,"svga_block":0,"target_guard_count":33,"toast_msg":"\u003c%Shiki心晴%\u003e 续费了提督","uid":8188680,"unit":"月","user_show":true,"username":"Shiki心晴"}}

	case "ROOM_BLOCK_MSG": //{"cmd":"ROOM_BLOCK_MSG","data":{"dmscore":30,"operator":1,"uid":64485611,"uname":"跑伊布"},"uid":"64485611","uname":"跑伊布"}

	case "SUPER_CHAT_MESSAGE_DELETE": //{"cmd":"SUPER_CHAT_MESSAGE_DELETE","data":{"ids":[3040322]},"roomid":22889518}

	case "WARNING": //{"cmd":"WARNING","msg":"\u8fdd\u53cd\u76f4\u64ad\u7740\u88c5\u89c4\u8303\uff0c\u8bf7\u7acb\u5373\u8c03\u6574","roomid":360972}

	case "ROOM_ADMINS": //{"cmd":"ROOM_ADMINS","uids":[34511301,3046462,70342468,19760927,18542928,26032648,2534465,222644084,5838917,261256945,36148763,2409312,20985904,15467107,8123504,24331910,123093331,203604204,158148524,4790535,23516532,517813,9258318,14009720,44962,8492611,40088902,396898658,14743014,111236746,363654394,148929092,34416584,13292254,47833209,44555324,25235251,382071050,15636436,25695827,36062954,272146505,1786718,5992259,13299969]}

	case "room_admin_entrance": //{"cmd":"room_admin_entrance","dmscore":45,"level":1,"msg":"系统提示：你已被主播设为房管","uid":13299969}

	case "THERMAL_STORM_DANMU_BEGIN": //{"cmd":"THERMAL_STORM_DANMU_BEGIN","data":{"session_id":80215,"room_id":23094579,"current_progress":2,"progress_bar":10,"countdown":200,"time":1642386549,"danmu_word":"小年快乐","pc_url":"https://i0.hdslb.com/bfs/live/e0c9a999b7de5aa80207b900d6b811bac6f2bd2f.mp4","app_url":"https://i0.hdslb.com/bfs/live/e0c9a999b7de5aa80207b900d6b811bac6f2bd2f.mp4","location":1}}
		//fmt.Printf("%vTHERMAL_STORM_DANMU_BEGIN R:%v\n", other.TI(), bdanmu.roomid)

	case "THERMAL_STORM_DANMU_UPDATE": //{"cmd":"THERMAL_STORM_DANMU_UPDATE","data":{"session_id":80215,"room_id":23094579,"current_progress":3,"progress_bar":10,"countdown":200,"time":1642386555,"danmu_word":"小年快乐"}}

	case "THERMAL_STORM_DANMU_OVER": //{"cmd":"THERMAL_STORM_DANMU_OVER","data":{"room_id":23094579,"progress_bar":10,"time":1642386570,"danmu_word":"小年快乐","session_id":80215}}

	case "VOICE_JOIN_STATUS": //{"cmd":"VOICE_JOIN_STATUS","data":{"room_id":23543137,"status":1,"channel":"voice728508","channel_type":"voice","uid":281322887,"user_name":"\u5b89\u54e5\u5b50__\u4e09\u4e09\u5bb6","head_pic":"http:\/\/i2.hdslb.com\/bfs\/face\/6d9bfd999194c7274b3ccebd34179a0d9efe048f.jpg","guard":0,"start_at":1642386600,"current_time":1642386600,"web_share_link":"https:\/\/live.bilibili.com\/h5\/23543137"},"roomid":23543137}

	case "MATCH_ROOM_CONF": //{"cmd":"MATCH_ROOM_CONF","data":{"type":"3","close_button":"0","force_push":"0","button_name":"","background":"https:\/\/i0.hdslb.com\/bfs\/live\/df0ce04c6e64bd0f9774ef39f25174268aa45a56.jpg","conf_id":"f0dc63b6626b84fc0272b855a3a1a7bd","conf_name":"2022LPL\u6625\u5b63\u8d5b","rooms_info":[{"room_id":"7734200","room_name":"\u4e3b\u623f\u95f4","live_status":1},{"room_id":"8016907","room_name":"\u526f\u623f\u95f4","live_status":2},{"room_id":"545068","room_name":"\u8001\u5b9e\u61a8\u539a\u7684\u7b11\u7b11","live_status":0},{"room_id":"23716020","room_name":"Icon","live_status":2},{"room_id":"24022841","room_name":"Langx919","live_status":0},{"room_id":"12655678","room_name":"\u706b\u661f\u5305\u89e3\u8bf4","live_status":0},{"room_id":"1440094","room_name":"\u5b88\u62a4\u8336\u8336","live_status":1},{"room_id":"22439496","room_name":"LGDPYL","live_status":0},{"room_id":"5279","room_name":"\u72d7\u72d7\u72d7\u96e8","live_status":1},{"room_id":"9513679","room_name":"\u6e38\u8361Yooudan","live_status":0},{"room_id":"22965398","room_name":"\u7b2c\u4e00\u89c6\u89d21","live_status":0},{"room_id":"22965466","room_name":"\u7b2c\u4e00\u89c6\u89d22","live_status":0},{"room_id":"22965503","room_name":"\u82f1\u6587\u6d41","live_status":0},{"room_id":"23713286","room_name":"\u7ad6\u5c4f\u623f\u95f41","live_status":0},{"room_id":"23030403","room_name":"\u7ad6\u5c4f\u623f\u95f42","live_status":0}],"season_info":[],"background_url":"","scatter":{"max":20,"min":5},"button_link":"","rooms_color":{"font_color":"#ffffff","background_color":"#34d0f4","border_color":"#34d0f4"},"state":0}}

	case "THERMAL_STORM_DANMU_CANCEL": //{"cmd":"THERMAL_STORM_DANMU_CANCEL","data":{"room_id":23094579,"time":1642387225,"danmu_word":"一起过小年","session_id":80219}}

	case "CUT_OFF": //{"cmd":"CUT_OFF","msg":"\u8fdd\u53cd\u76f4\u64ad\u8a00\u8bba\u89c4\u8303\uff0c\u8bf7\u7acb\u5373\u8c03\u6574","roomid":22936157}

	case "PK_BATTLE_MATCH_TIMEOUT": //{"cmd":"PK_BATTLE_MATCH_TIMEOUT","data":{"battle_type":2}}

	case "VIDEO_CONNECTION_START": //{"cmd":"VIDEO_CONNECTION_START","data":{"uid":104347189,"type":1,"uname":"\u5e74\u9f84\u5c0f\u7684\u70b9\u70b9_channel","face":"http:\/\/i1.hdslb.com\/bfs\/face\/0e3147688fc7f3362825f9582c68a97f645af6dd.jpg","channel_id":"72057594038033524","room_id":23917736,"toast":"\u5e74\u9f84\u5c0f\u7684\u70b9\u70b9_channel\u63a5\u53d7\u4e86\u89c6\u9891\u8fde\u7ebf","start_at":1642389658,"current_time":1642389663,"virtual_id":0,"communication":{"communication_min_bitrate":600,"communication_max_bitrate":1500,"communication_start_bitrate":1000,"communication_width":640,"communication_height":720,"communication_fps":25,"bypass_width":1280,"bypass_height":720,"bypass_bitrate":1500,"bypass_fps":25,"cdn":1}},"roomid":23917736}

	case "VIDEO_CONNECTION_JOIN_START": //{"cmd":"VIDEO_CONNECTION_JOIN_START","data":{"status":1,"invited_uid":104347189,"channel_id":"72057594038033524","invited_uname":"\u5e74\u9f84\u5c0f\u7684\u70b9\u70b9_channel","invited_face":"http:\/\/i1.hdslb.com\/bfs\/face\/0e3147688fc7f3362825f9582c68a97f645af6dd.jpg","start_at":1642389665,"current_time":1642389665},"roomid":23917736}

	case "VIDEO_CONNECTION_MSG": //{"cmd":"VIDEO_CONNECTION_MSG","data":{"channel_id":"72057594038033524","current_time":1642389665,"dmscore":4,"toast":"主播发起了视频连线"}}

	case "VIDEO_CONNECTION_JOIN_END": //{"cmd":"VIDEO_CONNECTION_JOIN_END","data":{"channel_id":"72057594038033525","start_at":1642392067,"toast":"\u4e3b\u64ad\u7ed3\u675f\u4e86\u4e0e\u4e00\u53ea\u4e45\u5b89\u7684\u89c6\u9891\u8fde\u7ebf","current_time":1642392068},"roomid":23917736}

	case "ROOM_SILENT_OFF": //{"data":{"type":"","level":0,"second":0},"cmd":"ROOM_SILENT_OFF"}

	case "GOTO_BUY_FLOW": //{"cmd":"GOTO_BUY_FLOW","data":{"text":"圣**正在去买"}}

	case "VOICE_JOIN_SWITCH": //{"cmd":"VOICE_JOIN_SWITCH","data":{"room_id":24009182,"room_status":0,"root_status":0},"roomid":24009182}

	case "SHOPPING_CART_SHOW": //{"cmd":"SHOPPING_CART_SHOW","data":{"status":2}}

	case "ROOM_ADMIN_REVOKE": //{"cmd":"ROOM_ADMIN_REVOKE","msg":"撤销房管","uid":269327559}

	case "ROOM_SILENT_ON": //{"data":{"type":"level","level":3,"second":-1},"cmd":"ROOM_SILENT_ON"}

	case "VIDEO_CONNECTION_LIST": //{"cmd":"VIDEO_CONNECTION_LIST","data":{"current_uid":1875602330,"type":1,"channel_id":"72057594038033655","current_uname":"\u6b23\u598d\u59d0\u59d0\u5416","certification_mark":{"role":0,"desc":"","type":-1},"current_face":"http:\/\/i2.hdslb.com\/bfs\/face\/cf058580516d5c9bd0840edb262da183bda5eaa9.jpg","start_at":1642405296,"current_time":1642405298,"current_face_frame":{"name":"S17\u94a2\u4e4b\u52c7\u8005","url":"https:\/\/i0.hdslb.com\/bfs\/live\/ecf40b519633b8c9dbcc304438437d4a344b5988.png","desc":""},"time_out":180,"virtual_id":0,"ready_timeout":180,"communication":{"communication_min_bitrate":600,"communication_max_bitrate":1500,"communication_start_bitrate":1000,"communication_width":640,"communication_height":720,"communication_fps":25,"bypass_width":1280,"bypass_height":720,"bypass_bitrate":1500,"bypass_fps":25,"cdn":1}},"roomid":23403443}

	case "GUARD_ACHIEVEMENT_ROOM": //{"cmd":"GUARD_ACHIEVEMENT_ROOM","data":{"anchor_basemap_url":"https://i0.hdslb.com/bfs/live/f873a04b1544d8f8bcc37fb2924ac9a2c2554031.png","anchor_guard_achieve_level":100,"anchor_modal":{"first_line_content":"恭喜当前舰队规模突破\u003c%100%\u003e","highlight_color":"#00DCFF","second_line_content":"至直播中心 - 获奖记录填写收货信息可获得实物勋章奖励哦～","show_time":5},"app_basemap_url":"https://i0.hdslb.com/bfs/live/83008812e86cae42049414e965d6ab6002f061cb.png","current_achievement_level":2,"dmscore":8,"event_type":1,"face":"http://i1.hdslb.com/bfs/face/7686f7cc4b345e53791afd90fd4ceecdd68ad8f5.jpg","first_line_content":"恭喜主播\u003c%温之九Dolores%\u003e","first_line_highlight_color":"#F2AE09","first_line_normal_color":"#FFFFFF","headmap_url":"https://i0.hdslb.com/bfs/vc/071eb10548fe9bc482ff69331983d94192ce9507.png","is_first":true,"is_first_new":false,"room_id":2098875,"second_line_content":"舰队规模突破\u003c%100%\u003e","second_line_highlight_color":"#06DDFF","second_line_normal_color":"#FFFFFF","show_time":3,"web_basemap_url":"https://i0.hdslb.com/bfs/live/83008812e86cae42049414e965d6ab6002f061cb.png"}}

	case "ROOM_SKIN_MSG": //{"cmd":"ROOM_SKIN_MSG","skin_id":65,"status":1,"end_time":2145888000,"current_time":1642409760,"only_local":false,"scatter":{"min":1,"max":200},"skin_config":{"android":{"1":{"zip":"https:\/\/i0.hdslb.com\/bfs\/live\/roomSkin\/d50490b2fb05cc32fe69a9ea40839fd68c575738.zip","md5":"1E111556D18406698350C007828EA0F8"}},"ios":{"1":{"zip":"https:\/\/i0.hdslb.com\/bfs\/live\/roomSkin\/8cc833f1e5e9caac5afd0f0d494dbb79e505b06e.zip","md5":"0781BED8AC8F09D18EB1F2091F211A82"}},"ipad":{"1":{"zip":"https:\/\/i0.hdslb.com\/bfs\/live\/roomSkin\/c814b4bc96e0ceae0be7c70300a49e2cdc9ccecc.zip","md5":"ED14E47E9D32FABB86AE857E8CBD1D1D"}},"web":{"1":{"zip":"https:\/\/i0.hdslb.com\/bfs\/live\/roomSkin\/bfac22ed069c4d41a6b9e2a305c9efd58bc07137.zip","md5":"9AE7E63C79466165ED03131CA6C62D1C","platform":"web","version":"1","headInfoBgPic":"https:\/\/i0.hdslb.com\/bfs\/live\/roomSkin\/7ba5a32cda0f985aa02bb05f453eac1f03cb976d.png","giftControlBgPic":"https:\/\/i0.hdslb.com\/bfs\/live\/roomSkin\/f864809e6be7b3fe834de6d37b5b7f42b2cdff2a.png","rankListBgPic":"https:\/\/i0.hdslb.com\/bfs\/live\/roomSkin\/00d1718591af1b5117c588f7bac1efb6c1e97fde.png","mainText":"#FFFFD432","normalText":"#FF999999","highlightContent":"#FFFFD432","border":"#33999999"}}}}

	case "CHANGE_ROOM_INFO": //{"cmd":"CHANGE_ROOM_INFO","background":"https:\/\/i0.hdslb.com\/bfs\/live\/2836bb7b84c792e2c6aadfd4d1cce13484775fa3.jpg","roomid":7875368}

	case "WIDGET_WISH_LIST": //{"cmd":"WIDGET_WISH_LIST","data":{"wish":[{"type":2,"gift_id":31036,"gift_name":"小花花","gift_img":"https://s1.hdslb.com/bfs/live/a676a6d59d0f8088ee60fed9765bb6ee96014ab7.png","gift_price":100,"target_num":3,"current_num":0},{"type":2,"gift_id":31060,"gift_name":"i了i了","gift_img":"https://s1.hdslb.com/bfs/live/1157a445487b39c0b7368d91b22290c60fa665b2.png","gift_price":100,"target_num":2,"current_num":0}],"wish_status":1,"sid":40,"wish_status_info":[{"wish_status_msg":"设定心愿","wish_status_img":"https://i0.hdslb.com/bfs/live/38f82bac32794e79776f7371269453652bd58a87.png","wish_status":0},{"wish_status_msg":"达成","wish_status_img":"https://i0.hdslb.com/bfs/live/1dae635924437239fc69e561a1a9467508521249.png","wish_status":2},{"wish_status_msg":"收集失败","wish_status_img":"https://i0.hdslb.com/bfs/live/3bbd30fdd32d085cc90e9ccd98c65a886dca9a8f.png","wish_status":3}],"wish_name":"心愿"}}

	case "SHOPPING_EXPLAIN_CARD": //{"cmd":"SHOPPING_EXPLAIN_CARD","data":{"goods_id":"1483289728435216384","goods_name":"kinbor小week周计划方格本时间管理备忘录女生款小笔记本子手帐本todolist计划本效率日程本学生考研记事本","goods_price":"9.4","goods_max_price":"","sale_status":0,"coupon_name":"","goods_icon":"http://i0.hdslb.com/bfs/e-commerce-goods/84f64f5cc8a3cfa70d56076a582fb7f1e2ac4c10.jpg","status":3,"h5_url":"https://live.bilibili.com/p/html/live-app-ecommerce/index.html?is_live_half_webview=1\u0026hybrid_rotate_d=1\u0026hybrid_half_ui=1,3,100p,70p,0,0,30,100,12,0;2,2,375,100p,0,0,30,100,0,0;3,3,100p,70p,0,0,30,100,12,0;4,2,375,100p,0,0,30,100,0,0;5,3,100p,70p,0,0,30,100,12,0;6,3,100p,70p,0,0,30,100,12,0;7,3,100p,70p,0,0,30,100,12,0\u0026source=1\u0026goods_id=1483289728435216384#/taobao","source":1,"timestamp":1642509975,"is_pre_sale":0,"activity_info":null,"pre_sale_info":null,"early_bird_info":null,"unique_id":"1483420469131460608","uid":0,"selling_point":"","coupon_discount_price":""}}

	case "ACTIVITY_BANNER_CHANGE": //{"cmd":"ACTIVITY_BANNER_CHANGE","data":{"list":[{"id":1460,"timestamp":1642514405,"position":"top","activity_title":"小年夜1月18日","cover":"https://i0.hdslb.com/bfs/live/bb5b0d12fb31146d4ae9b2c2fd7caad22cc6544a.png","jump_url":"https://www.bilibili.com/blackboard/live/activity-sFXS88wTVC.html","is_close":1,"action":"delete"}]}}

	case "ACTIVITY_BANNER_CHANGE_V2": //{"cmd":"ACTIVITY_BANNER_CHANGE_V2","data":{"timestamp":1642514405,"list":[{"id":1460,"position":"top","type":0,"activity_title":"小年夜1月18日","cover":"https://i0.hdslb.com/bfs/live/bb5b0d12fb31146d4ae9b2c2fd7caad22cc6544a.png","jump_url":"https://www.bilibili.com/blackboard/live/activity-sFXS88wTVC.html","is_close":1,"action":"delete","platform_info":[{"platform":"android","condition":0,"build":0},{"platform":"ios","condition":0,"build":0}],"ext_data":""}]}}

	case "WATCHED_CHANGE": //{"cmd":"WATCHED_CHANGE","data":{"num":2076,"text_small":"2076","text_large":"2076人看过"}}

	case "HOT_BUY_NUM": //{"cmd":"HOT_BUY_NUM","data":{"goods_id":"1503969950176239616","num":3412}}

	default:
		//fmt.Println("CMD", cmd, string(msg))
		cmdlock.Lock()
		if _, ok := cmdmap[cmd]; !ok {
			cmdmap[cmd] = string(msg)

			a := fmt.Sprintf("case \"%v\": //%v //ROOM: %v\n", cmd, string(msg), bdanmu.roomid)
			printLogFile(a)
			//fmt.Println(a)
		}
		cmdlock.Unlock()
	}
}

func getDanmuInfo(roomid int) (token string, host string, port int) {
	url := "https://api.live.bilibili.com/xlive/app-room/v1/index/getDanmuInfo"
	data := `access_key=` + ACCESS + `&actionKey=appkey&appkey=1d8b6e7d45233436&build=6560300&channel=huawei&device=android&mobi_app=android&platform=android&room_id=` + strconv.Itoa(roomid) + `&statistics=%7B%22appId%22%3A1%2C%22platform%22%3A3%2C%22version%22%3A%226.56.0%22%2C%22abtest%22%3A%22%22%7D&ts=` + other.StrTime()
	data = other.Sign(data)
	r, c := other.AppReqGet(url + "?" + data)
	if !c {
		return
	}
	//fmt.Println(roomid, string(r))
	token = fastjson.GetString(r, "data", "token")
	host = fastjson.GetString(r, "data", "ip_list", "0", "host")
	port = fastjson.GetInt(r, "data", "ip_list", "0", "port")
	return
}

// Encode 将消息编码
func Encode(message string) ([]byte, error) {
	// 读取消息的长度，转换成int32类型（占4个字节）
	var length = int32(len(message))
	var pkg = new(bytes.Buffer)
	// 写入消息头
	err := binary.Write(pkg, binary.BigEndian, 4+length)
	if err != nil {
		return nil, err
	}
	// 写入消息实体
	err = binary.Write(pkg, binary.BigEndian, []byte(message))
	if err != nil {
		return nil, err
	}
	return pkg.Bytes(), nil
}
